package request

type TagListRequest struct {
	Name     string `json:"name" form:"name"` // 标签名称
	Page     int    `json:"page" form:"page" binding:"required,gte=1"`
	PageSize int    `json:"page_size" form:"page_size" binding:"required,gte=1,lte=100"`
}

type TagAddRequest struct {
	Name string `json:"name" binding:"required,min=2,max=50" label:"标签名称"`
	Img  string `json:"img"  label:"标签图片"`
}

type TagUpdateRequest struct {
	ID   uint   `json:"id" binding:"required" label:"标签ID"`
	Name string `json:"name" binding:"required,min=2,max=50" label:"标签名称"`
	Img  string `json:"img"  label:"标签图片"`
}

type TagDelRequest struct {
	ID uint `json:"id" binding:"required" label:"标签ID"`
}

func (r TagListRequest) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"page.required":      "页码不能为空",
		"page.gte":           "页码不能小于1",
		"page_size.required": "每页条数不能为空",
		"page_size.gte":      "每页条数不能小于1",
		"page_size.lte":      "每页条数不能大于100",
	}
}

func (r TagAddRequest) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"name.required": "标签名称不能为空",
		"name.min":      "标签名称长度不能小于2",
		"name.max":      "标签名称长度不能大于50",
	}
}

func (r TagUpdateRequest) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"id.required":   "标签ID不能为空",
		"name.required": "标签名称不能为空",
		"name.min":      "标签名称长度不能小于2",
		"name.max":      "标签名称长度不能大于50",
	}
}

func (r TagDelRequest) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"id.required": "标签ID不能为空",
	}
}

// TagGameListRequest 获取标签下的游戏列表请求
type TagGameListReques1t struct {
	ID       uint `uri:"id" binding:"required" label:"标签ID"`
	Page     int  `form:"page" binding:"required,gte=1"`
	PageSize int  `form:"page_size" binding:"required,gte=1,lte=100"`
}

type TagGameListRequest struct {
	ID       uint `json:"id" binding:"required" label:"标签ID"`
	Page     int  `json:"page" form:"page" binding:"required,gte=1"`
	PageSize int  `json:"page_size" form:"page_size" binding:"required,gte=1,lte=100"`
}

func (r TagGameListRequest) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"id.required":        "标签ID不能为空",
		"page.required":      "页码不能为空",
		"page.gte":           "页码不能小于1",
		"page_size.required": "每页条数不能为空",
		"page_size.gte":      "每页条数不能小于1",
		"page_size.lte":      "每页条数不能大于100",
	}
}

type TagBatchAddGameRequest struct {
	TagID uint   `json:"tag_id" binding:"required" label:"标签ID"`
	IDS   []uint `json:"ids" binding:"required" label:"游戏ID"`
}

func (r TagBatchAddGameRequest) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"tag_id.required": "标签ID不能为空",
		"ids.required":    "游戏ID不能为空",
	}
}
